#include <bits/stdc++.h>
using namespace std;

int n;
int cnt1;
int cnt5;
int cnt10;

int main() {
    cin >> n;
    int x;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        if (x == 1)
            cnt1++;
        else if (x == 5)
            cnt5++;
        else if (x == 10)
            cnt10++;
    }
    cout << cnt1 << endl << cnt5 << endl << cnt10;
    return 0;
}